package com.dao.Impl;


import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.dao.BaseDao;
import com.dao.SingerTypeDao;
import com.entity.SingerType;


@Repository
public class SingerTypeDaoImpl extends BaseDao implements SingerTypeDao{

	@Override
	public List<Map<String, Object>> querySingerType() {
		String sql ="select singerTypeId,singerTypeName from singertype";
		return executeQuery(sql, null);
	}
	
	@Override
	public Map<String, Object> querySingerTypeId(int singerTypeId) {
		String sql ="select singerTypeId,singerTypeName from singertype where singerTypeId=?";
		Object[] params={singerTypeId};
		return executeQueryMap(sql, params);
	}

	@Override
	public int addSingerType(SingerType singerType) {
		String sql ="insert into singertype(singerTypeName)values(?)";
		Object[] params={singerType.getSingerTypeName()};
		return executeUpdate(sql, params);
	}

	@Override
	public int editSingerType(SingerType singerType) {
		String sql ="update singertype 	set singerTypeName=?	where singerTypeId=?";
		Object[] params={singerType.getSingerTypeName(),singerType.getSingerTypeId()};
		return executeUpdate(sql, params);
	}

	@Override
	public int delSingerType(int singerTypeId) {
		String sql ="delete from singerType where singerTypeId=?";
		Object[] params={};
		return executeUpdate(sql, params);
	}


}
